home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8480 < prev    next >
Encoding:
Text File  |  1996-08-05  |  910 b   |  38 lines

  1. Path: lrz-muenchen.de!news
  2. From: watzka@stat.uni-muenchen.de (Kurt Watzka)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: strange behaviour of doubles
  5. Date: 4 Mar 1996 12:11:07 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4hemkr$shd@sparcserver.lrz-muenchen.de>
  9. References: <1996Mar4.014052.6236@dcs.warwick.ac.uk>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. D.C.Molero@dcs.warwick.ac.uk (Daniel Castillo Molero) writes:
  13.  
  14.  
  15. >#include <stdio.h>
  16. >#include <stdlib.h>
  17.  
  18. >main() {
  19. >double x, y;
  20. >scanf("%g", &x);
  21. >while (x != 0.0) {
  22. >  scanf("%g", &y);
  23. >  printf("%g %g\n", x, y);
  24. >  scanf("%g", &x);
  25. >}
  26. >return(0);
  27. >}
  28.  
  29. Unfortunately, there is some lack of symmetry between printf() and
  30. scanf(). If you want to read doubles, use "%lf" etc.
  31.  
  32. Kurt
  33. --
  34. | Kurt Watzka                             Phone : +49-89-2180-6254
  35. | watzka@stat.uni-muenchen.de
  36. | ua302aa@sunmail.lrz-muenchen.de
  37.  
  38.